const { db, query } = require("../../db/db");
const util = require("util");
const moment = require("moment");

async function GetUserSignInToDay(req, res) {
  let UserId = Number(req.params.username);
  const Date = req.body.Date;

  const Select_user = util.format(
    "Select \
    UserId from User_Sign_In_Day Where UserId=%s AND SignInDate='%s'",
    UserId,
    Date
  );

  const Select_user_res = await query(Select_user);

  let Yes = "";

  if (Select_user_res.length > 0) {
    Yes = true;
  } else {
    Yes = false;
  }

  res.send({
    status: 0,
    Yes: Yes,
  });
}

module.exports = { GetUserSignInToDay };
